00001 <?php
00003 define("PATH_TO_ROOT", "../");
00005 require_once (PATH_TO_ROOT."common/init.inc.php");
00006
00007 require_once (PATH_TO_ROOT."style/classes/class.style.inc.php");
00008 $STYLES_CSSFILE = Style::getCSSPath() ."stylesheets.css";
00010 require_once (PATH_TO_ROOT."photogallery/admin/classes/class.gallerysettings.inc.php");
00011 $gSettings = new GallerySettings();
00012 ?>
00013
00014 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
00015 <html lang="de">
00016
00017 <head>
00018 <title>eStudy - Bild bearbeiten</title>
00019
00020 <meta http-equiv="Content-Type" content="text/html; charset=<?php
00021 echo $settings["charset"]; ?>" />
00022 <link href="<?php echo $STYLES_CSSFILE ?>" rel="stylesheet" type="text/css" />
00023 <?php
00024
00025 if (file_exists(Style::getCSSPath() ."ieextra.css")) echo "\t<!--[if lt IE 7]><link href=\"".Style::getCSSPath() ."ieextra.css\" rel=\"stylesheet\" type=\"text/css\" /><![endif]-->\n";
00026
00027
00028 if (file_exists(Style::getCSSPath() ."ie_pngfix.js")) echo "\t<!--[if lt IE 7]><script type=\"text/javascript\">var stylepath='".Style::getCSSPath() ."';</script><script defer=\"defer\" type=\"text/javascript\" src=\"".Style::getCSSPath() ."ie_pngfix.js\"></script><![endif]-->\n";
00029 ?>
00030
00031 <script type='text/javascript'><!--
00032 function getx(obj){
00033 return ((obj.offsetParent)?getx(obj.offsetParent):0)+obj.offsetLeft;
00034 }
00035 function gety(obj){
00036 return ((obj.offsetParent)?gety(obj.offsetParent):0)+obj.offsetTop;
00037 }
00038 function moveit(e){
00039 if(!e)
00040 e=window.event;
00041
00042 if(e){
00043 var offset=(e.pageY)?0:2;
00044 var image=document.getElementById('image');
00045 var vert=document.getElementById('vertical1');
00046 var horz=document.getElementById('horizontal1');
00047 var vert2=document.getElementById('vertical2');
00048 var horz2=document.getElementById('horizontal2');
00049
00050
00051 var offsetLeft=getx(image)+offset;
00052 var offsetTop=gety(image)+offset;
00053 var mouseX=(e.pageX)?e.pageX:e.clientX+document.documentElement.scrollLeft-offset;
00054 var mouseY=(e.pageY)?e.pageY:e.clientY+document.documentElement.scrollTop-offset;
00055
00056 if(mouseX>=offsetLeft && mouseX<offsetLeft+image.offsetWidth){
00057 vert.style.left=((mouseX-2) +"px");
00058 vert2.style.left=((mouseX+2) +"px");
00059 vert.style.height=vert2.style.height=image.offsetHeight+"px";
00060 vert.style.top=vert2.style.top=(offsetTop-offset) +"px";
00061 }
00062
00063 if(mouseY>=offsetTop && mouseY<offsetTop+image.offsetHeight){
00064 horz.style.top=((mouseY-2) +"px");
00065 horz2.style.top=((mouseY+2) +"px");
00066 horz.style.width=horz2.style.width=image.offsetWidth +"px";
00067 horz.style.left=horz2.style.left=(offsetLeft-offset) +"px";
00068 }
00069 }
00070 }
00071
00072 function start() {
00073
00074 document.getElementById('image').onmousemove = moveit;
00075 document.getElementById('vertical1').onmousemove = moveit;
00076 document.getElementById('horizontal1').onmousemove = moveit;
00077 document.getElementById('vertical2').onmousemove = moveit;
00078 document.getElementById('horizontal2').onmousemove = moveit;
00079 }
00080
00081 function showhelpers(){
00082 document.getElementById('vertical1').style.display = "block";
00083 document.getElementById('horizontal1').style.display = "block";
00084 document.getElementById('vertical2').style.display = "block";
00085 document.getElementById('horizontal2').style.display = "block";
00086 }
00087
00088 function hidehelpers(){
00089 document.getElementById('vertical1').style.display = "none";
00090 document.getElementById('horizontal1').style.display = "none";
00091 document.getElementById('vertical2').style.display = "none";
00092 document.getElementById('horizontal2').style.display = "none";
00093 }
00094
00095 window.onload=start;
00096 if(window.attachEvent)
00097 window.attachEvent("onload",start);
00098
00099 </head>
00100
00101 <body>
00102 <div id="cropDiv">
00103
00104 <?php
00105 $picPath = isset($_GET['picurl']) ? $_GET['picurl'] : '';
00106 $ext = isset($_GET['ext']) ? $_GET['ext'] : '';
00107 $extParam = "&ext=".$ext;
00108 $picSize = GetImageSize($picPath);
00109 $maxWidth = 600;
00110 $maxHeight = 600;
00111 $maxW = $maxH = '';
00112 if ($picSize[0] > $maxWidth) $maxW = '&maxw='.$maxWidth;
00113 if ($picSize[1] > $maxHeight) $maxH = '&maxh='.$maxHeight;
00114 $crop_x1 = '';
00115 $crop_y1 = '';
00116 $crop_x2 = '';
00117 $crop_y2 = '';
00118 $progress = 0;
00119 $cropParam = '';
00120 $cpreview = 0;
00121 if ((isset($_GET['pic_x'])) && (!isset($_GET['crop_x1']))) {
00122 $crop_x1 = $_GET['pic_x'];
00123 $crop_y1 = $_GET['pic_y'];
00124 $progress = 1;
00125 $cpreview = 1;
00126 $cropParam = "&cpreview=1&cx1=$crop_x1&cy1=$crop_y1";
00127 }
00128 if ((isset($_GET['pic_x'])) && (isset($_GET['crop_x1']))) {
00129 $crop_x1 = $_GET['crop_x1'];
00130 $crop_y1 = $_GET['crop_y1'];
00131 $crop_x2 = $_GET['pic_x'];
00132 $crop_y2 = $_GET['pic_y'];
00133 $progress = 2;
00134 $cpreview = 1;
00135 $cropParam = "&cpreview=1&cx1=$crop_x1&cy1=$crop_y1&cx2=$crop_x2&cy2=$crop_y2";
00136 }
00137 if (isset($_GET['apply'])) $progress = 3;
00138 echo "<b>Sie befinden sich zur Zeit im Crop Modus</b> <br />
00139 Hier können Sie das Bild auf einen bestimmten Teil zurecht schneiden.<hr /><br />";
00140
00141 echo '<table align="center"><tr>';
00142 for ($i = 0 ; $i < 4 ; $i++) {
00143 if ($progress == $i) {
00144 $bgcolor = "#FF2222";
00145 } else {
00146 $bgcolor = "#969392";
00147 }
00148 if (($i < 2) && ($i < $progress) && ($progress < 3)) {
00149 $jsBack = $i-$progress;
00150 } else {
00151 $jsBack = 0;
00152 }
00153 if ($jsBack) {
00154 $step = '<a href="javascript:history.go('.$jsBack.');" style="color: #FFFFFF !important;"title="In den Schritt '.($i+1) .'. wechseln">'.($i+1) .'</a>';
00155 } else {
00156 $step = ($i+1);
00157 }
00158 echo '<td style="border: 1px outset #FFFFFF; border-color: #FBF822; background:'.$bgcolor.'; color: #FFFFFF; width: 20px; height: 20px; text-align: center;">'.$step.'</td>';
00159 }
00160 echo '</tr></table><br />';
00161 if ($progress == 0) {
00162 if (isset($_GET['mode']) && $_GET['mode'] == "newpic") echo "<a href='newtopic.php?picurl=".$_GET['picurl']."&picOK=1&boardid=".$_GET['boardid']."&cx1=0&cy1=0&cx2=0&cy2=0' title='Ohne Veränderung weiter'>Falls Sie keine Veränderungen wünschen klicken Sie bitte hier.</a> <br /> <br />";
00163 echo "<b>Schritt 1:</b> Bitte klicken Sie auf den <b>oberen linken</b> Teil, der ausgeschnitten werden soll.<br /><br />";
00164 }
00165 if ($progress == 1) echo "<b>Schritt 2:</b> Bitte klicken Sie auf den <b>unteren rechten</b> Teil, der ausgeschnitten werden soll.<br /><br />";
00166 if ($progress == 2) {
00167 if (($_GET['mode'] == "newpic") || ($_GET['mode'] == "newpicedit")) echo "<b>Schritt 3:</b> Nun müssen Sie nur noch die Veränderungen übernehmen (Achtung: Originalbild wird ersetzt).";
00168 if ($_GET['mode'] == "edit") echo "<b>Schritt 3:</b> Nun müssen Sie nur noch die Veränderungen übernehmen (Originalbild wird endgültig abgelegt).";
00169 if (($_GET['mode'] == "quote") || ($_GET['mode'] == "editquote")) echo "<b>Schritt 3:</b> Nun müssen Sie nur noch die Veränderungen übernehmen (Originalbild wird nicht verändert).";
00170 }
00171 echo '<form id="modifypic" action="modifypic.php" method="get">
00172 <input type="hidden" name="picurl" value="'.$picPath.'" />
00173 <input type="hidden" name="ext" value="'.$ext.'" />
00174 <input type="hidden" name="postid" value="'.(isset($_GET['postid']) ? $_GET['postid'] : '') .'" />
00175 <input type="hidden" name="boardid" value="'.(isset($_GET['boardid']) ? $_GET['boardid'] : '') .'" />
00176 <input type="hidden" name="mode" value="'.(isset($_GET['mode']) ? $_GET['mode'] : '') .'" />
00177 <input type="hidden" name="threadid" value="'.(isset($_GET['threadid']) ? $_GET['threadid'] : '') .'" />
00178 <input type="hidden" name="time" value="'.(isset($_GET['time']) ? $_GET['time'] : '') .'" />';
00179 if ($progress < 2) {
00180 if ($progress == 1) echo ' <input type="hidden" name="crop_x1" value="'.$crop_x1.'" />
00181 <input type="hidden" name="crop_y1" value="'.$crop_y1.'" />
00182 <input type="hidden" name="crop_x2" value="'.$crop_x2.'" />
00183 <input type="hidden" name="crop_y2" value="'.$crop_y2.'" />';
00184 echo ' <input type="hidden" name="cpreview" value="'.$cpreview.'" />
00185 <input type="image" name="pic" src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.$cropParam.'" alt="Galeriebild" style="border: 1px solid #000000; cursor: crosshair;" onmouseover="showhelpers()" onmouseout="hidehelpers()" id="image" />
00186 </form>
00187 ';
00188 }
00189 if ($progress == 2) {
00190 echo '
00191 <input type="hidden" name="cx1" value="'.$crop_x1.'" />
00192 <input type="hidden" name="cy1" value="'.$crop_y1.'" />
00193 <input type="hidden" name="cx2" value="'.$crop_x2.'" />
00194 <input type="hidden" name="cy2" value="'.$crop_y2.'" />
00195 <input type="hidden" name="apply" value="1" />
00196 <input type="submit" value="Veränderungen übernehmen" />
00197 </form>
00198 <img src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.$cropParam.'" alt="Galeriebild" style="border: 1px solid #000000;" />
00199 ';
00200 }
00201 if ($progress == 3) {
00202
00203 include_once PATH_TO_ROOT."common/classes/class.modifypic.inc.php";
00204 echo "</form>";
00205
00206 if (($_GET['mode'] == "newpic") || ($_GET['mode'] == "newpicedit")) {
00207 $mp = new ModifyPic(1, $picPath, $ext);
00208 $factor = $mp->getCropResizeFactor($maxWidth, $maxHeight);
00209 $rx = $factor[0];
00210 $ry = $factor[1];
00211 $mp->modify(0, $gSettings->get_maxwidth(), $gSettings->get_maxheight(), ($_GET['cx1']*$rx), ($_GET['cy1']*$ry), ($_GET['cx2']*$rx), ($_GET['cy2']*$ry));
00212 $cropParam = "&cx1=".round($_GET['cx1']*$rx) ."&cy1=".round($_GET['cy1']*$ry) ."&cx2=".round($_GET['cx2']*$rx) ."&cy2=".round($_GET['cy2']*$ry);
00213 if ($_GET['mode'] == "newpic") echo '<a href="'.PATH_TO_ROOT.'photogallery/newtopic.php?picurl='.$picPath.'&picOK=1&boardid='.$_GET['boardid'].$cropParam.'">Weiter zum Formular</a>';
00214 else echo '<a href="'.PATH_TO_ROOT.'photogallery/showtopic.php?threadid='.$_GET['threadid'].'">Zurück zum Bildeintrag</a>';
00215 echo '<br /><br />
00216 <img src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.'" alt="Galeriebild" style="border: 1px solid #000000;" />';
00217 }
00218
00219 if ($_GET['mode'] == "edit") {
00220 $mp = new ModifyPic(1, $picPath, $ext);
00221 $factor = $mp->getCropResizeFactor($maxWidth, $maxHeight);
00222 $rx = $factor[0];
00223 $ry = $factor[1];
00224 $mp->modify(0, $gSettings->get_maxwidth(), $gSettings->get_maxheight(), ($_GET['cx1']*$rx), ($_GET['cy1']*$ry), ($_GET['cx2']*$rx), ($_GET['cy2']*$ry));
00225 echo '<a href="'.PATH_TO_ROOT.'photogallery/edit.php?postid='.$_GET['postid'].'">Zurück zur Bild bearbeiten Seite</a>
00226 <br /><br />
00227 <img src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.'" alt="Galeriebild" style="border: 1px solid #000000;" />';
00228 }
00229
00230 if (($_GET['mode'] == "quote") || ($_GET['mode'] == "editquote")) {
00231 $mp = new ModifyPic(0, $picPath, $ext);
00232 $factor = $mp->getCropResizeFactor($maxWidth, $maxHeight);
00233 $rx = $factor[0];
00234 $ry = $factor[1];
00235 $cropParam = "&cx1=".round($_GET['cx1']*$rx) ."&cy1=".round($_GET['cy1']*$ry) ."&cx2=".round($_GET['cx2']*$rx) ."&cy2=".round($_GET['cy2']*$ry);
00236 if ($_GET['mode'] == "quote") echo '<a href="'.PATH_TO_ROOT.'photogallery/showtopic.php?threadid='.$_GET['threadid'].'&replyto='.$_GET['postid'].'&time='.$_GET['time'].$cropParam.'&updatepicquote=1&pagenum=lastpage#reply" title="Weiter zur Kommentareingabe">Weiter zum Kommentarformular</a>
00237 <br /><br />
00238 <img src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.$cropParam.'" alt="Galeriebild" style="border: 1px solid #000000;" />';
00239 if ($_GET['mode'] == "editquote") echo '<a href="'.PATH_TO_ROOT.'photogallery/edit.php?postid='.$_GET['postid'].$cropParam.'&picquoteedit=1" title="Weiter zur Kommentareingabe">Weiter zum Kommentarformular</a>
00240 <br /><br />
00241 <img src="'.PATH_TO_ROOT.'common/makethumb.php?picurl='.rawurlencode($picPath) .$maxW.$maxH.$extParam.$cropParam.'" alt="Galeriebild" style="border: 1px solid #000000;" />';
00242 }
00243 }
00244 ?>
00245 <!-- Das sind die Hilfslinien, die werden nur bei aktivem JavaScript angezeigt -->
00246 <div id='vertical1' style='display:none;overflow:hidden;position:absolute;width:0px;border-left:1px dashed white;'></div>
00247 <div id='vertical2' style='display:none;overflow:hidden;position:absolute;width:0px;border-right:1px dashed black;'></div>
00248 <div id='horizontal1' style='display:none;position:absolute;height:0px;overflow:hidden;border-top:1px dashed white;'></div>
00249 <div id='horizontal2' style='display:none;position:absolute;height:0px;overflow:hidden;border-bottom:1px dashed black;'></div>
00250 </div>
00251 </body>
00252
00253 </html>